package com.aaa.outbound.service.impl;

import com.aaa.entity.outbound.OutorderDetail;
import com.aaa.entity.outbound.Pick;
import com.aaa.outbound.mapper.OutorderDetailMapper;
import com.aaa.outbound.service.OutorderDetailService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author aaa
 * @since 2020-12-01
 */
@Service
public class OutorderDetailServiceImpl extends ServiceImpl<OutorderDetailMapper, OutorderDetail> implements OutorderDetailService {
    @Autowired
    private OutorderDetailMapper outorderDetailMapper;

    @Override
    public Page<OutorderDetail> searchOutOrderDetail(Integer page, Integer limit, OutorderDetail outorderDetail) {
        Page<OutorderDetail> pageinfo=new Page<>(page,limit);
        String commoditybar=outorderDetail.getCommoditybar();
        QueryWrapper<OutorderDetail> queryWrapper=new QueryWrapper<>();
        if(StringUtils.isNotEmpty(commoditybar)){
            queryWrapper.like("commoditybar",commoditybar);
        }

        this.outorderDetailMapper.selectPage(pageinfo,queryWrapper);
        return pageinfo;
    }

    @Override
    public Integer selectSumQtyByOutorderno(String outorderno) {
        return outorderDetailMapper.selectSumQtyByOutorderno(outorderno);
    }

    @Override
    public List<OutorderDetail> selectOutoderDetailByOutorderno(String outorderno) {
        return outorderDetailMapper.selectOutoderDetailByOutorderno(outorderno);
    }
}
